package cn.wizzer.app.user.modules.models;


import cn.wizzer.app.user.modules.models.enums.PurchaseEnum;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 用户购买记录
 */
@Data
@Table("user_purchase")
@TableIndexes({@Index(name = "unique_no", fields = {"orderNo"}, unique = true)})
public class UserPurchase extends BaseModel implements Serializable {
    @Column
    @Name
    @Comment("ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(els = {@EL("uuid()")})
    private String id;

    @Column("goodsId")
    @Comment("商品ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String goodsId;

    @Column("userId")
    @Comment("用户ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String userId;


    @Column("status")
    @Comment("状态")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private PurchaseEnum status;


    @Column("addressId")
    @Comment("地址")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String addressId;


    @Column("price")
    @Comment("价格")
    @ColDefine(type=ColType.FLOAT, width=16, precision=6)
    private BigDecimal price;

    @Column("remark")
    @Comment("备注")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String remark;

    @Column("orderNo")
    @Comment("订单号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String orderNo;

    @Column("logisticsCompany")
    @Comment("物流公司")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String logisticsCompany;

    @Column("logisticsNo")
    @Comment("物流单号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String logisticsNo;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;



}
